package com.william.jdbcplus.core.dialects.ddl.column;

import com.william.jdbcplus.core.metadata.TableColumnInfo;
import com.william.jdbcplus.common.entity.Entity;
import com.william.jdbcplus.core.util.datameta.TableMetaColumnInfo;

public interface IColumn {
    /**
     * 新增字段
     */
    <M extends Entity> String add(Class<M> clazz, TableColumnInfo fieldInfo);

    /**
     * 删除字段
     */
    <M extends Entity> String drop(Class<M> clazz, TableColumnInfo fieldInfo);

    /**
     * 重命名字段
     */
    <M extends Entity> String rename(Class<M> clazz, TableColumnInfo fieldFrom, TableColumnInfo fieldTo);

    /**
     * 修改字段
     */
    <M extends Entity> String modify(Class<M> clazz, TableColumnInfo fieldInfo, TableMetaColumnInfo metaColumn);

    /**
     * 修改不成功，重建表字段，将原有列数据在重建数据字段后复制过去
     */
    <M extends Entity> String rebuild(Class<M> clazz, TableColumnInfo fieldInfo, TableMetaColumnInfo metaColumn);

    /**
     * 检查是否与数据库一致
     */
    <M extends Entity> Boolean match(Class<M> clazz, TableColumnInfo fieldInfo, TableMetaColumnInfo metaColumn);

    /**
     * 检查数据类型是否一致
     */
    <M extends Entity> Boolean matchTypeName(Class<M> clazz, TableColumnInfo fieldInfo, TableMetaColumnInfo metaColumn);

    /**
     * 检查数据长度是否一致
     */
    <M extends Entity> Boolean matchLength(Class<M> clazz, TableColumnInfo fieldInfo, TableMetaColumnInfo metaColumn);

    /**
     * 检查小数位数是否一致
     */
    <M extends Entity> Boolean matchDigits(Class<M> clazz, TableColumnInfo fieldInfo, TableMetaColumnInfo metaColumn);

    /**
     * 检查可空约束是否一致
     */
    <M extends Entity> Boolean matchNullable(Class<M> clazz, TableColumnInfo fieldInfo, TableMetaColumnInfo metaColumn);
}
